<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<ui:composition template="/layouts/default.xhtml">
	<ui:define name="title">#{text['paiementDetail.title']}</ui:define>
	<ui:param name="menu" value="EleveMenu" />
	<ui:param name="menuleft" value="PaiementFormMenu" />
	<ui:param name="menudetailtop" value="PaiementEtatMenu" />
	<ui:param name="menudetaileleve" value="EleveDetailMenu"/>
	<ui:param name="menudetail" value="EleveDetailMenu"/>

	<ui:define name="body">
		<c:set var="delObject" value="#{text['paiementList.paiement']}" />
		<script type="text/javascript">var msgDelConfirm =
           "<h:outputFormat value="#{text['delete.confirm']}"><f:param value="#{delObject}" /></h:outputFormat>";
        </script>
		<div class="col-sm-12">
			<ui:include src="/common/eleve-detail-top.xhtml"/>
			<h:form id="paiementForm">
			
					<div class="form-group">
						<h:inputHidden value="#{paiementController.paiement.id}" id="id" />
						<h:inputHidden value="#{paiementController.paiement.eleve.id}" id="idEleve" />
					</div>
					
					<div class="page-header">
						<h3>#{text['paiement.tab.etatPay']}</h3>
					</div> 
					<div class="row">
						<c:forEach var="etatPay" items="#{paiementController.etatPayes}">
							<p:commandLink update=":paiementForm:displayDetail" oncomplete="dlgDetail.show()">
								<div class="col-sm-3 form-group">
					            	<p class="calendar">${etatPay.stringDatePaiement}<br/>
					            		<c:choose>
					            			<c:when test="${etatPay.paye}">
					            				<c:choose>
					            					<c:when test="${etatPay.payOK}">
					            						<p:graphicImage url="/images/green-ok-icon.png"></p:graphicImage><br/>	
					            					</c:when>
					            					<c:otherwise>
					            						<p:graphicImage url="/images/red-ok-icon.png"></p:graphicImage><br/>
					            					</c:otherwise>
					            				</c:choose>					            				
       									      		<h:outputText style="color: blue;" value="${etatPay.paiement.avance}" escape="true"/>
								            		<c:if test="${etatPay.paiement != null}">
								            		/
								            		</c:if>
								            		<h:outputText style="color: gray;" value="${etatPay.paiement.reste}" escape="true"/>
								            		
					            			</c:when>
					            			<c:otherwise>
					            				<p:graphicImage url="/images/non.png"></p:graphicImage><br/>
					            				<h:outputText style="color: gray;" value="0.0 / 0.0" escape="true"/>
					            			</c:otherwise>
					            		</c:choose>
					            		<em>${etatPay.libelle}</em>
					            	</p>
						        </div>
						        <f:setPropertyActionListener value="${etatPay.paiement}" target="#{paiementController.paiement}" />
					        </p:commandLink>
				        </c:forEach>
				   </div>
				   
				   <p:dialog header="#{text['paiementDetail.title']}" width="70%"
						resizable="false" id="displayDetail" widgetVar="dlgDetail"
						showEffect="fade" hideEffect="highlight" modal="true">
						
						<div class="row">
							<div class="col-sm-4 form-group">
								<blockquote>
									<h:outputLabel styleClass="control-label" for="anneeScolaire" value="#{text['anneeScolaire.anneeScolaire']}" />
									<footer>
										<h:outputText id="anneeScolaire" value="#{paiementController.paiement.anneeScolaire.anneeScolaire}" escape="true"/>
									</footer>
								</blockquote>
							</div>
							
							<div class="col-sm-4 form-group">
								<blockquote>
									<h:outputLabel styleClass="control-label" for="datePaiement" value="#{text['paiement.datePaiement']}" />
									<footer>
										<h:outputText id="datePaiement" value="#{paiementController.paiement.datePaiement}" escape="true"/>
									</footer>
								</blockquote>
							</div>
							
							<div class="col-sm-4 form-group">
								<blockquote>
									<h:outputLabel styleClass="control-label" for="eleve" value="#{text['paiement.eleve']}" />
									<footer>
										<h:outputText id="eleve" value="#{paiementController.paiement.eleve.fullName}" escape="true"/>
									</footer>
								</blockquote>
							</div>
						</div>
						
						<div class="row">
							<div class="col-sm-4 form-group">
								<blockquote>
									<h:outputLabel styleClass="control-label" for="moisPaye" value="#{text['paiement.moisPaye']}" />
									<footer>
										<h:outputText id="moisPaye" value="#{paiementController.paiement.moisPaye.libelle}" escape="true"/>
									</footer>
								</blockquote>
							</div>
							
							<div class="col-sm-4 form-group">
								<blockquote>
									<h:outputLabel styleClass="control-label" for="avance" value="#{text['paiement.avance']}" />
									<footer>
										<h:outputText id="avance" value="#{paiementController.paiement.avance}" escape="true"/>
									</footer>
								</blockquote>
							</div>
							
							<div class="col-sm-4 form-group">
								<blockquote>
									<h:outputLabel styleClass="control-label" for="modePaiement" value="#{text['paiement.modePaiement']}" />
									<footer>
										<h:outputText id="modePaiement" value="#{paiementController.paiement.modePaiement.libelle}" escape="true"/>
									</footer>
								</blockquote>
							</div>
							
						</div>
						
						<div class="row">
							<div class="col-sm-4 form-group">
								<blockquote>
									<h:outputLabel styleClass="control-label" for="numeroCheque" value="#{text['paiement.numeroCheque']}" />
									<footer>
										<h:outputText id="numeroCheque" value="#{paiementController.paiement.numeroCheque}" escape="true"/>
									</footer>
								</blockquote>
							</div>
							
							<div class="col-sm-6 form-group">
								<blockquote>
									<h:outputLabel styleClass="control-label" for="description" value="#{text['paiement.description']}" />
									<footer>
										<h:outputText id="description" value="#{paiementController.paiement.descriptionAvanceJustifie}" escape="true"/>
									</footer>
								</blockquote>
							</div>
						</div>
					</p:dialog>
			</h:form>
		</div>
	</ui:define>
</ui:composition>
</html>